package au.com.zonski.gwlite.j2me.client;

import net.jscience.math.kvm.MathFP;

public class GWEntity 
{
	public static final byte TYPE_BULLET 	= 0;
	public static final byte TYPE_WORM_TAIL = 1;
	public static final byte TYPE_STAR   	= 2;
	public static final byte TYPE_DIAMOND 	= 3;
	public static final byte TYPE_SHY_SQUARE = 4;
	public static final byte TYPE_UNBROKEN_SQUARE = 5;
	public static final byte TYPE_SEEKER_CIRCLE = 6;
	public static final byte TYPE_WORM		= 7;
	public static final byte TYPE_INTERCEPTOR = 8;
	public static final byte TYPE_BUTTERFLY = 9;
	public static final byte TYPE_BLACKHOLE = 10;
	public static final byte TYPE_PLAYER 	= 11;
	public static final byte TYPE_BROKEN_SQUARE = 12;
	public static final byte TYPE_EXPLOSION = 13;
	public static final byte TYPE_THRUST	= 14;
	
	public static final byte MAX_ENEMY_ID	= 10;
	public static final byte MIN_ENEMY_ID	= 2;
	
	public static final byte[] BASE_POINTS = { 
		0, 	// bullet
		0,  // tail
		25, // star
		50, // diamond
		100,// shy square
		50, // unbroken square
		10, // seeker circle
		50, // worm
		100,// interceptor
		10, // butterfly
		100,// blackhole
		0,	// player
		25, // broken square
		};

	public static final int[] BASE_WEIGHTS = { 
		0, 	// bullet
		0,  // tail
		300, // star
		800, // diamond
		1000,// shy square
		1100, // unbroken square
		300, // seeker circle
		2000, // worm
		5000,// interceptor
		150, // butterfly
		100000,// blackhole
		0,	// player
		0, // broken square
		};

	public int x;
	public int y;
	public int width;
	public int height;
	public byte type;

	public Object controllerData;

	public GWEntity( GWLiteCanvas gameState, int cx, int cy, byte type )
	{
		this( cx - MathFP.toFP( gameState.spriteDetails[type][4] )/2, 
				cy - MathFP.toFP( gameState.spriteDetails[type][5] )/2, 
				MathFP.toFP( gameState.spriteDetails[type][4] ), 
				MathFP.toFP( gameState.spriteDetails[type][5] ), 
				type 
		);
	}
	
	public GWEntity( int x, int y, int width, int height, byte type )
	{
		this.x = x;
		this.y = y;
		this.width = width;
		this.height = height;
		this.type = type;
	}
	
	public static final int getPoints( byte type )
	{
		return BASE_POINTS[ type ];
	}
	
	public static final int getWeight( byte type )
	{
		return BASE_WEIGHTS[ type ] * 4;
	}
}
